<?php
/**
* test widget
*/
class newWidget extends CWidget
{    
    public function init()
    {
        //当视图中执行$this->beginWidget()时候会执行这个方法
        //可以在这里进行查询数据操作
    }
 
    public function run()
    {
        $condition = new CDbCriteria();
        $condition->addCondition('recommend=1');
        $condition->order = 't.hot desc';
        $row = News::model()->find($condition);
        unset($condition);
        $this->render('new',array(
            'row'=>$row,
        ));
    }
}
?>